<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge，chrome=1">

    <title>用户关系管理</title>

    <link rel="stylesheet" href="/static/css-lib/bootstrap.min.css" />
    <link rel="stylesheet" href="/static/css-lib/bootstrap-select.min.css" />

    <style>
        .head-bg {
            background-color: #eee;
            padding-top: 10px;
        }
        .input-box {
            border: 1px solid #ccc;
            font-size: 14px;
            -webkit-border-radius: 0 4px 4px 0;
            -moz-border-radius: 0 4px 4px 0;
            border-radius: 0 4px 4px 0;
            width: 100%;
            background: #fff;
        }
        .cont-box {
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="container-fluid">

        <c:choose>
            <c:when test="${empty RelationshipManager.studentRealName}">
                <c:set value="${RelationshipManager.studentName}" var="studentName" scope="page" />
            </c:when>
            <c:otherwise>
                <c:set value="${RelationshipManager.studentRealName}" var="studentName" scope="page" />
            </c:otherwise>
        </c:choose>

        <c:choose>
            <c:when test="${RelationshipManager.isEnable == 0}">
                <c:set value="" var="isEnableRelation" scope="page" />
            </c:when>
            <c:otherwise>
                <c:set value="checked" var="isEnableRelation" scope="page" />
            </c:otherwise>
        </c:choose>

        <!-- 基础信息 -->
        <div class="row head-bg">
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                <ul class="list-group">
                    <li class="list-group-item">学生姓名：&nbsp;&nbsp;&nbsp;<span>${studentName}</span></li>
                </ul>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                <ul class="list-group">
                    <li class="list-group-item">课程：&nbsp;&nbsp;&nbsp;【${RelationshipManager.gradeSec}】${RelationshipManager.grade}（${RelationshipManager.subjectName}）</li>
                </ul>
            </div>
        </div>

        <!-- 老师、家长联系 -->
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cont-box">
                <div class="input-group">
                    <span class="input-group-addon">老师</span>
                    <div class="input-box">
                        <select id="teacher" class="form-control selectpicker" data-live-search="true">
                            <option value="0" selected>请选择</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 cont-box">
                <div class="input-group">
                    <span class="input-group-addon">家长</span>
                    <div class="input-box">
                        <select id="parents" class="form-control selectpicker" data-live-search="true">
                            <option value="0" selected>请选择</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <!-- 管理 -->
        <div class="row cont-box">
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                <ul class="list-group">
                    <li class="list-group-item">备注</li>
                    <li class="list-group-item">
                        <textarea id="comment-area" maxlength="250" style="min-height: 190px;width: 100%;border: none;outline: none;">${RelationshipManager.comment}</textarea>
                    </li>
                </ul>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                <ul class="list-group">
                    <li class="list-group-item">
                        <div class="checkbox">
                            <label>
                                <input id="is-enable" type='checkbox' <c:out value="${isEnableRelation}" /> />是否启用
                            </label>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="row cont-box">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <ul class="list-group">
                    <li class="list-group-item">
                        <button id="sub-btn" data-id="<c:out value="${RelationshipManager.relationId}" />" type="button" class="btn btn-primary">提交</button>
                    </li>
                </ul>
            </div>
        </div>

    </div>

    <!-- 错误提示框 -->
    <div id="error-box" class="modal fade" tabindex="-1" data-backdrop="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">错误</h4>
                </div>
                <div id="error-content" class="modal-body"></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 信息提示框 -->
    <div id="warn-box" class="modal fade" tabindex="-1" data-backdrop="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">警告</h4>
                </div>
                <div class="modal-body">您尚未勾选启用这条关系，如果不启用，将不会生效，确定要提交吗？</div>
                <div class="modal-footer">
                    <button id="cancelReq" type="button" class="btn btn-default" data-dismiss="modal">返回修改</button>
                    <button id="confirmReq" type="button" class="btn btn-primary">确认提交</button>
                </div>
            </div>
        </div>
    </div>

    <script src="/static/js-lib/jquery-3.4.1.min.js"></script>
    <script src="/static/js-lib/bootstrap-select.min.js"></script>
    <script src="/static/js-cus/admin/Frame-RelationshipManager.js"></script>
</body>
</html>